xen/arm: create shared memory nodes in guest device tree
authorPenny Zheng <Penny.Zheng@arm.com>
Thu, 8 Sep 2022 13:55:11 +0000 (21:55 +0800)
committerStefano Stabellini <stefano.stabellini@amd.com>
Fri, 9 Sep 2022 19:59:10 +0000 (12:59 -0700)
commitc7fe72607a37c0bb251b662006a5020e4d7db67e
treec4fa7f47e20539c5f4ff8a0c536cb8750010c54f
parentb7133c10a3fd3b66b8d6a657a55855ab78f0a75b
xen/arm: create shared memory nodes in guest device tree

We expose the shared memory to the domU using the "xen,shared-memory-v1"
reserved-memory binding. See
Documentation/devicetree/bindings/reserved-memory/xen,shared-memory.txt
in Linux for the corresponding device tree binding.

To save the cost of re-parsing shared memory device tree configuration when
creating shared memory nodes in guest device tree, this commit adds new field
"shm_mem" to store shm-info per domain.

For each shared memory region, a range is exposed under
the /reserved-memory node as a child node. Each range sub-node is
named xen-shmem@<address> and has the following properties:
- compatible:
        compatible = "xen,shared-memory-v1"
- reg:
        the base guest physical address and size of the shared memory region
- xen,id:
        a string that identifies the shared memory region.
- xen,offset: (borrower VMs only)
        64 bit integer offset within the owner virtual machine's shared
        memory region used for the mapping in the borrower VM.
Currently, we provide "xen,offset=<0x0>" as a temporary placeholder.

Signed-off-by: Penny Zheng <penny.zheng@arm.com>
Reviewed-by: Stefano Stabellini <sstabellini@kernel.org>
Reviewed-by: Bertrand Marquis <bertrand.marquis@arm.com>
[stefano: fix code style, add return -EOPNOTSUPP;]
Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
xen/arch/arm/domain_build.c
xen/arch/arm/include/asm/kernel.h